package shellstation;
import java.sql.ResultSet;
import java.util.ArrayList;

public class ProductModel {
    
    private ArrayList listSize= new ArrayList();
    private ArrayList SizeList= new ArrayList();
    private ArrayList productName= new ArrayList();
    private ArrayList productData= new ArrayList();

    public ProductModel(){

    }

    public ArrayList getlistSize(){

        ResultSet rs;
        ProductController r= new ProductController();
        
     
        rs= r.getSizes();
        try{

            while( rs.next()) {
                String s=  rs.getString("size");
                listSize.add(s);
                
            }
        }
        catch(Exception e){
            e.printStackTrace();
        }

        return listSize;
    }

    public ResultSet getProduct(String size){

        ResultSet rs;
        ProductController rc= new ProductController();

        rs= rc.getProduct(size);

        return rs;
    }
    
    public ResultSet getProductTable(String name){

        ResultSet rs;
        ProductController rc= new ProductController();

        rs= rc.getProductTable(name);

        return rs;
    }
    public void getAddProduct (String productName, String status, String size, String price, String stock) {
        ResultSet rs;
        ProductController rc = new ProductController();
        
        rc.getAddProduct(productName, status, size, price, stock);
    }

    public ResultSet getAllProduct(){

        ResultSet rs;
        ProductController rc= new ProductController();

        rs= rc.getAllProduct();

        return rs;
    }
    
     public ArrayList getSizeUnit(){

        ResultSet rs;
        ProductController r= new ProductController();
        
     
        rs= r.getSizeUnit();
        try{

            while( rs.next()) {
                String s=  rs.getString("sizeUnit");
                SizeList.add(s);
                
            }
        }
        catch(Exception e){
            e.printStackTrace();
        }

        return SizeList;
    }
     
     public ResultSet getSizeID(String sizeUnit){

        ResultSet rs;
        ProductController rc= new ProductController();

        rs= rc.getSizeID(sizeUnit);

        return rs;
    }
    public static void main(String[] args){
        ProductModel r= new ProductModel();

        r.getlistSize();

    }
}
